xquery version "1.0";

declare namespace util="http://exist-db.org/xquery/util";
declare namespace dc="http://purl.org/dc/elements/1.1/";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace session="http://exist-db.org/xquery/session";

declare option exist:serialize "method=xhtml media-type=text/xml";

element { "albums" }{ 
	fn:subsequence(
	for $album in doc("Test1/Albums.xml")//album
	order by number(data($album/comment-count)) descending 
	return $album
	,1,9)
}
			
